package com.example.java.collection;

import java.util.Collection;
import java.util.Deque;
import java.util.Iterator;
import java.util.LinkedList;

/**
 * @author zty
 * @apiNote
 * @project_name java-project
 * @user tain
 * @create_at 2023/6/18 1:55
 * @create_vio IntelliJ IDEA
 */
public class MyStack<T> implements Collection<T> {
    private final Deque<T> context;

    public MyStack(){
        this.context = new LinkedList<>();
    }

    public T pop(){
        return context.pop();
    }

    public void push(T e){
        context.push(e);
    }

    public T peek(){
        return context.peek();
    }

    @Override
    public int size() {
        return context.size();
    }

    @Override
    public boolean isEmpty() {
        return context.isEmpty();
    }

    @Override
    public boolean contains(Object o) {
        return context.contains(o);
    }

    @Override
    public Iterator<T> iterator() {
        return context.iterator();
    }

    @Override
    public Object[] toArray() {
        return context.toArray();
    }

    @Override
    public <T1> T1[] toArray(T1[] a) {
        return context.toArray(a);
    }

    @Override
    public boolean add(T t) {
        return context.add(t);
    }

    @Override
    public boolean remove(Object o) {
        return context.remove(o);
    }

    @Override
    public boolean containsAll(Collection<?> c) {
        return false;
    }

    @Override
    public boolean addAll(Collection<? extends T> c) {
        return false;
    }

    @Override
    public boolean removeAll(Collection<?> c) {
        return false;
    }

    @Override
    public boolean retainAll(Collection<?> c) {
        return false;
    }

    @Override
    public void clear() {
        context.clear();
    }
}
